import request from '@/utils/request';

// 查询字典类型列表
export function listType(data, query) {
  return request({
    url: '/web/base/system/dict/type/page',
    method: 'post',
    data: data,
    params: query,
  });
}

// 查询字典类型详细
export function getType(dictId) {
  return request({
    url: '/web/base/system/dict/type/info/' + dictId,
    method: 'get',
  });
}

// 新增字典类型
export function addType(data) {
  return request({
    url: '/web/base/system/dict/type/add',
    method: 'post',
    data: data,
  });
}

// 修改字典类型
export function updateType(data) {
  return request({
    url: '/web/base/system/dict/type/edit',
    method: 'post',
    data: data,
  });
}

// 删除字典类型
export function delType(dictId) {
  return request({
    url: '/web/base/system/dict/type/delete/' + dictId,
    method: 'post',
  });
}

// 刷新字典缓存
export function refreshCache() {
  return request({
    url: '/web/base/system/dict/type/refreshCache',
    method: 'post',
  });
}

// 获取字典选择框列表
export function optionselect() {
  return request({
    url: '/web/base/system/dict/type/optionselect',
    method: 'get',
  });
}

// 导出
export function exportType(data, params) {
  return request({
    url: '/web/base/system/dict/type/export',
    method: 'post',
    data,
    params,
    responseType: 'blob',
    filename: `dict_${new Date().getTime()}.xlsx`,
  });
}
